home *** CD-ROM | disk | FTP | other *** search
- /* INT86X.C ---p. 628 */
- #ifdef EXAMPLE_1
- #include <stdio.h>
- #include <dos.h>
- /* Interrupt number for DOS functions */
- #define DOS_INT 0x21
- /* DOS "change directory" function */
- #define DOS_CHDIR 0x3b
- /* Buffer to hold path name */
- static char buff[80];
- main()
- {
- /* Far pointer to directory name string*/
- char far *dirname;
- /* Set up the structure for registers */
- union REGS xr;
- struct SREGS sr;
- printf("Enter pathname: ");
- gets(buff);
- /* Set up far pointer to name*/
- dirname = &buff[0];
- xr.h.ah = DOS_CHDIR;
- /* Offset of string to DX */
- xr.x.dx = FP_OFF(dirname);
- /* Segment of string to DS */
- sr.ds = FP_SEG(dirname);
- int86x(DOS_INT, &xr, &xr, &xr);
- }
- #endif
- #include <dos.h>
- #define DOS_INT 0x21
- /* DOS "print string" function */
- #define DOS_PRTSTR 0x9
- char str[]="Testing String Print Function$";
- main()
- {
- union REGS xr;
- struct SREGS sr;
- xr.h.ah = DOS_PRTSTR;
- /* Offset string to DX */
- xr.x.dx = FP_OFF(str);
- /* Segment of string to DS */
- sr.ds = FP_SEG(str);
- int86x(DOS_INT, &xr, &xr, &sr);
- }